package com._1.message.rabbitMq_order;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class RabbitReichardtReader {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void readOrderMessage() {
        String msg= (String) rabbitTemplate.receiveAndConvert(RabbitMqOrderConfig.ORDER_QUEUE_NAME);
        System.out.println("从队列 " + RabbitMqOrderConfig.ORDER_QUEUE_NAME + " 中读取消息： " + msg);
    }
}

